<?php
$this->pageTitle = Yii::app()->name . ' - Login';
$this->breadcrumbs = array(
    'Login',
);

CHtml::$errorContainerTag = 'span';
$errorRegister = $registerModel->getErrors();
?>
<div class="sub-page">
    <h2>Welcome, Please Sign In</h2>

    <div class="all-product">
        <?php $class = "";
        if ($loginModel->getErrors()) { $class="red-form";?>
            <span class="red-text">
                        	<img src="<?php echo Yii::app()->request->baseUrl ?>/data/images/warning.png" width="16"
                                 height="16"> &nbsp;
                        	Error: Sorry, there is no match for that email address and/or password.
                        </span>
        <?php } ?>

        <?php $form = $this->beginWidget('CActiveForm',     array(
            'id' => 'login-form',
            'enableAjaxValidation' => false,
        )); ?>
        <div class="contact">
            <div class="ct-title">Returning Customers: Please Log In</div>
            <div class="form-style marT20">
                <p>
                    <?php echo $form->labelEx($loginModel, 'email'); ?>
                    <?php echo $form->textField($loginModel, 'email', array('class' => $class)); ?>
                </p>

                <p>
                    <?php echo $form->labelEx($loginModel, 'password'); ?>
                    <?php echo $form->passwordField($loginModel, 'password', array('class' => $class)); ?>
                </p>

                <p>
                    <label>&nbsp;</label>
                    <a href="/site/forgot">Forgot your password?</a>
                </p>

                <p>
                    <label>&nbsp;</label>
                    <?php echo CHtml::submitButton('Login', array('class' => 'red-button')); ?>
                </p>
            </div>
        </div>
        <?php $this->endWidget(); ?>
        <?php $form = $this->beginWidget('CActiveForm', array(
            'id' => 'register-form',
            'enableAjaxValidation' => false,
        )); ?>
        <div class="contact">
            <div class="ct-title">New? Please Provide Your Billing Information</div>
            <?php if(Yii::app()->user->hasFlash('success')):?>
                <div class="info">
                    <?php echo Yii::app()->user->getFlash('success'); ?>
                </div>
            <?php endif; ?>
            <div class="form-style marT20">
                <p>
                    <?php echo $form->labelEx($registerModel, 'email'); ?>
                    <?php echo $form->textField($registerModel, 'email'); ?>

<?php if(isset($errorRegister['email'])){?>
                    <div class="red-text">
                        <label></label>
                    <?php echo $form->error($registerModel,'email'); ?>
                        </div>
                        <?php }?>
                </p>

                <p>
                    <?php echo $form->labelEx($registerModel, 'password'); ?>
                    <?php echo $form->passwordField($registerModel, 'password'); ?>
<?php if(isset($errorRegister['password'])){?>
                    <div class="red-text">
                        <label></label>
                    <?php echo $form->error($registerModel,'password'); ?>
                        </div>
                        <?php } ?>
                </p>

                <p>
                    <?php echo $form->labelEx($registerModel, 'repeat_password'); ?>
                    <?php echo $form->passwordField($registerModel, 'repeat_password'); ?>
<?php if(isset($errorRegister['repeat_password'])){?>
                    <div class="red-text">
                        <label></label>
                    <?php echo $form->error($registerModel,'repeat_password'); ?>
                        </div>
                        <?php } ?>
                </p>

                <p>
                    <?php echo $form->labelEx($registerModel, 'phone'); ?>
                    <?php echo $form->textField($registerModel, 'phone'); ?>
<?php if(isset($errorRegister['phone'])){?>
                    <div class="red-text">
                        <label></label>
                    <?php echo $form->error($registerModel,'phone'); ?>
                        </div>
                        <?php } ?>
                </p>

                <p>
                    <label>&nbsp;</label>
                    <?php echo CHtml::submitButton('Register', array('class' => 'red-button')); ?>
                </p>
            </div>
        </div>
        <?php $this->endWidget(); ?>
    </div>

</div><!-- form -->
